home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / VideoToolbox 96.06.15 / VideoToolboxSources / Uniform.c < prev    next >
Text File  |  1993-12-15  |  420b  |  19 lines

  1. /*
  2. Uniform.c
  3. UniformSample() returns a random sample from the interval [0,1). 
  4. It has a mean of 1/2 and a variance of 1/12.
  5.  
  6. Also see: Binomial.c, ChiSquare.c, Exponential.c, Normal.c
  7.  
  8. HISTORY:
  9. 12/28/91 dgp extracted it from Normal.c
  10. */
  11. #include "VideoToolbox.h"
  12.  
  13. double UniformSample(void)
  14. {
  15.     return rand()*(1.0/(RAND_MAX+1.0));
  16. }
  17. /*
  18. The constant is evaluated by the compiler. Multiplication is faster than division.
  19. */